import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";

@Injectable()
export class InformationListProvider {
    public url = '/content/v1/app/list';
    public preUrl='/content/v1/app/preview'

    constructor(public http: HttpClient) {

    }

    // 获取咨询列表
    getInformation(keyword, pageNum, pageSize): Observable<any> {
        return this.http.get(this.url, {
            params: {
                keyword: keyword,
                pageNum: pageNum,
                pageSize: pageSize
            }
        })
    }

    // 获取资讯预览列表
    getInformationPrev():Observable<any>{
        return this.http.get(this.preUrl)
    }

    // 外链资讯统计接口
    saveExternallinks(contentId,userRole):Observable<any>{
        return this.http.get('/content/v1/app/contentRecord',
            {
                params:{
                    contentId:contentId,
                    userRole:userRole
                },
                responseType:'text'
            })
    }
}
